﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using LMKJ.Classes;

namespace LMKJ
{
    public partial class viewresidentdetails : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                string nric = Request.QueryString["details"];

                Resident r = DatabaseManager.RetrieveResidentByNric(nric);

                if (r != null)
                {
                    nricLbl.Text = nric;
                    nameLbl.Text = r.Name;
                    dobLbl.Text = r.Dob;
                    genderLbl.Text = r.Gender;
                    addressLbl.Text = r.Address;
                    postalLbl.Text = r.Postal;
                    ethnicityLbl.Text = r.Ethnicity;
                    descriptionLbl.Text = r.Description;
                }
            }
        }

        protected void editBtn_Click(object sender, EventArgs e)
        {
            Response.Redirect("editresident.aspx?details=" + nricLbl.Text);
        }

        protected void backBtn_Click(object sender, EventArgs e)
        {
            Response.Redirect("searchresidents.aspx");
        }
    }
}